LDR INTERFACING WITH AVR
A Light Dependent Resistor (LDR) or a photo resistor is a passive electronic component, basically a resistor which has a resistance that varies depending of the light intensity. In this you will know how to interface LDR with AVR.
Synopsis

A Light Dependent Resistor (LDR) or a photo resistor is a passive electronic component, basically a resistor which has a resistance that varies depending of the light intensity. A photo-resistor is made of a high resistance semiconductor that absorbs photons and based on the quantity and frequency of the absorbed photons the semiconductor material give bound electrons enough energy to jump into the conduction band. The resulting free electrons conduct electricity resulting in lowering resistance of the photo-resistor. The number of electrons is dependent of the photons frequency.

Description

They are made up of semiconductor materials having high resistance. There are many different symbols used to indicate a LDR, one of the most commonly used symbol is shown in the figure below. The arrow indicates light falling on it.


Photo conductivity is an optical phenomenon in which the materials conductivity is increased. When light is absorbed by the material. When light falls i.e. when the photons fall on the device, the electrons in the valence band of the semiconductor material are excited to the conduction band. These photons in the incident light should have energy greater than the band gap of the semiconductor material to make the electrons jump from the valence band to the conduction band. Hence when light having enough energy strikes on the device, more and more electrons are excited to the conduction band which results in large number of charge carriers. The result of this process is more and more current starts flowing through the device when the circuit is closed and hence it is said that the resistance of the device has been decreased.

LDR’s are light dependent devices whose resistance is decreased when light falls on them and that is increased in the dark. When a light dependent resistor is kept in dark, its resistance is very high. This resistance is called as dark resistance. It can be as high as 1012Ω and if the device is allowed to absorb light its resistance will be decreased drastically. If a constant voltage is applied to it and intensity of light is increased the current starts increasing. Figure below shows resistance vs. illumination curve for a particular LDR.


Photocells or LDR’s are non-linear devices. There sensitivity varies with the wavelength of light incident on them. Some photocells might not at all response to a certain range of wavelengths. Based on the material used different cells have different spectral response curves.

When light is incident on a photocell it usually takes about 8 to 12 ms for the change in resistance to take place, while it takes one or more seconds for the resistance to rise back again to its initial value after removal of light. This phenomenon is called as resistance recovery rate. This property is used in audio compressors. LDR’s are less sensitive than photo diodes and phototransistor. (A photo diode and a photocell (LDR) are not the same, a photo-diode is a pn junction semiconductor device that converts light to electricity, whereas a photocell is a passive device, there is no pn junction in this nor it “converts” light to electricity).

Types of Light Dependent Resistors

1. Intrinsic photo resistors (Undoped semiconductor): These are made of pure semiconductor materials such as silicon or germanium. Electrons get excited from valance band to conduction band when photons of enough energy fall on it and number charge carriers is increased.

2. Extrinsic photo resistors: These are semiconductor materials doped with impurities which are called as dopants. Theses dopants create new energy bands above the valence band which are filled with electrons. Hence this reduces the band gap and less energy is required in exciting them. Extrinsic photo resistors are generally used for long wavelengths.


The structure of a light dependent resistor consists of a light sensitive material which is deposited on an insulating substrate such as ceramic. The material is deposited in zigzag pattern in order to obtain the desired resistance and power rating. This zigzag area separates the metal deposited areas into two regions. Then the ohmic contacts are made on the either sides of the area.

The resistances of these contacts should be as less as possible to make sure that the resistance mainly changes due to the effect of light only. Materials normally used are cadmium sulphide, cadmium selenide,  indium antimonide and cadmium sulphonide. The use of lead and cadmium is avoided as they are harmful to the environment.

Applications

=> Low cost and simple structure

=> Light sensors

=> Street lamps

=> Alarm clock

=> Burglar alarm circuits

=> Light intensity meters

Proteus design for LDR interfacing with AVR


Orcad design for LDR interfacing with AVR


LDR Interfacing with AVR

/*  Name     : main.c
 *  Purpose  : Source code for LDR interface with ATMEGA16.
 *  Author   : Gemicates
 *  Date     : 2017-09-11
 *  Website  : www.gemicates.org
 *  Revision : None
 */
#ifndef F_CPU
#define F_CPU 8000000UL                                        // 8 MHz clock speed
#endif

#include<avr/io.h>
#include<util/delay.h>
 
void LDR_init(void);
unsigned int LDR_read();
 
int main(void)
{
	unsigned int value;
	DDRB=0xFF;
	LDR_init();	                                       // Initialization of ADC

	while(1)
	{
		value=LDR_read();
		PORTB=value;
		_delay_ms(500);
	} 
}
 
void LDR_init(void)		                                // Initialization of ADC
{
	ADMUX=(1<<REFS0);	                                // AVcc with external capacitor at AREF
	ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);	// Enable ADC and set Prescaler division factor as 128
} 
unsigned int LDR_read()
{	
	ADMUX |=0x00;						// selecting channel
 	ADCSRA|=(1<<ADSC);					// start conversion
	while(ADCSRA==0x9f);		                        // waiting for ADIF, conversion complete
	ADCSRA|=(1<<ADIF);					// clearing of ADIF, it is done by writing 1 to it
 	return (ADC);
}

Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close